<template>
  <div class="photoinfo-container">
    <h3>{{ photoinfo.title }}</h3>
    <p class="subtitle">
      <span>发表时间：{{ photoinfo.add_time | format }}</span>
      <span>点击：{{ photoinfo.click }}次</span>
    </p>

    <hr>
    <!-- 图片缩略图 -->
    <div id="thumbs">
      <vue-preview :slides="list" @close="handleClose"></vue-preview>
    </div>
    <div></div>
    <!-- 图片内容区域 -->
    <div class="content" v-html="photoinfo.content"></div>
  </div>
</template>

<script>
import { getimageInfo, getThumImages } from "@/api";
export default {
  data() {
    return {
      id: this.$route.params.id,
      photoinfo: {},
      list: []
    };
  },
  created() {
    getimageInfo(this.id).then(res => {
      // console.log(res, 8899);
      this.photoinfo = res.data.message[0];
    });
    // 获取缩略图
    getThumImages(this.id).then(res => {
      console.log(res, 55);
      if (res.data.status == 0) {
        res.data.message.forEach(item => {
          item.w = 300;
          item.h = 300;
          item.msrc = item.src;
        });
        this.list = res.data.message;
        console.log(this.list, 88);
      }
    });
  },
  methods: {
    handleClose() {}
  }
};
</script>

<style lang="less" scoped>
img {
  width: 100px;
}
</style>

